package com.study.guide.codec.protobuf;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;

public class TimeClient {
	public static void main(String[] args) {
		EventLoopGroup group = new NioEventLoopGroup();
		try {
			Bootstrap sb = new Bootstrap();
			sb.group(group)
				.channel(NioSocketChannel.class)
				.option(ChannelOption.TCP_NODELAY, true)
                .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 3000)
				.handler(new TimeClientInitializer());
			ChannelFuture cf = sb.connect("localhost",8899).sync();
			cf.channel().closeFuture().sync();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}finally {
				group.shutdownGracefully();

			}
	}
}
